<?php

// $Id$


require_once(TANGRA_MAIN_DIR.'form/guardable_form.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/password/form_field_password.class.php');
require_once(TANGRA_MAIN_DIR.'/form/static_html_form_generator.class.php');


class User_Chpwd_Form extends Guardable_Form {
	function __construct() {
		parent::__construct('user_chpwd', 'admin/user_chpwd.php');

		$f_pwd = new Form_Field_Password('password', true, 50);
		$this->add_field($f_pwd);

		$f_pwd2 = new Form_Field_Password('password2', true, 50);
		$f_pwd2->add_potential_error('passwords_not_match');
		$f_pwd2->add_potential_error('weak_password');
		$this->add_field($f_pwd2);
	}


	public function generate_html() {
		$html_gen = new Static_HTML_Form_Generator($this, 'modules/form_html_tpl_static_ajax_metallic_en', 'en');
		$html_gen->create_default_tpl_maps();
		$html_gen->change_field_p_error_map_entry('password2', 'passwords_not_match', 'modules/panel/forms/en/user_chpwd/field_error_pwds_not_match.tpl');
		$html_gen->change_field_p_error_map_entry('password2', 'weak_password', 'modules/panel/forms/en/user_chpwd/field_error_weak_password.tpl');

		printbr('<pre>');
		printbr(htmlentities($html_gen->get_static_html()));
		printbr('</pre>');
	}
}

